<template>
    <div id="authenticateUnitDetail">
      <div v-for="(item,index) in QYcontentData" :key="index+'QYcontentData'">
        <p style="height: 50px;display: flex;align-items: center;border-bottom: 1px solid #D2D2D2;">
          <span style="margin-right: 10px;" class="line"></span>
          {{item.name}}
        </p>
        <div class="list">
          <ul>
            <li v-for="(item1,index1) in item.children" :key="index1+'QYcontentData'" :style="{borderBottom:index1===QYcontentData.length-1?'none':'1px solid #D2D2D2'}">
              <span style="margin-right: 20px;font-size: 14px;">{{item1.name}}</span>
              <span style="float: right;font-size: 14px;">{{rowData[item1.value]}}</span>
              <!--<span v-else style="float: right;font-size: 14px;">{{rowData[item1.value]}}</span>-->
            </li>
          </ul>
        </div>
      </div>
      <div style="text-align: center;padding: 10px 0 ">
        <el-button @click="confirmBtn" type="primary" size="mini">确定</el-button>
      </div>
    </div>
</template>

<script>
  import { getAuthenticateUnit } from '@/utils/api'
  export default {
    name: "authenticateUnitDetail",
    data(){
      return{
        rowData:{},
        QYcontentData:[
          {
            name:'企业信息',
            children:[
              {
                name:'企业名称',
                value:'COMAPNY_NAME'
              },
              {
                name:'统一社会信用代码',
                value:'QYID'
              },
              {
                name:'法人姓名',
                value:'FRXM'
              },
              {
                name:'法人联系电话',
                value:'FRLXDH'
              },
              {
                name:'单位地址',
                value:'DWDZ'
              },
              {
                name:'联系人',
                value:'LXR'
              },
              {
                name:'联系电话',
                value:'LXDR'
              }
            ]
          },
          {
            name:'入驻信息',
            children:[
              {
                name:'服务区域',
                value:'FWQY_CITYNAME'
              },
              {
                name:'服务类型',
                value:'FWLX_DICNAME'
              },
              {
                name:'企业介绍',
                value:'QYJS'
              },
            ]
          }
        ],

      }
    },
    methods:{
      getData: async function (data) {
        let params = {
          "tableid": "f0a36ff8c75a4eddafbecd355672c912",
          "currentPage": 1,
          "numPerPage": 10,
          "complexQuery": [
            {
              "name": "ID",
              "value": data,
              "operation": "="
            }
          ]
        }
        const res = await getAuthenticateUnit(params);
        this.rowData = res.data.data.data.resultList[0]
      },
      confirmBtn(){
        if (this.$route.query.type){
          // 疑似危房
          this.$router.push({
            path: '/DetailInto',
            query: {
              data1: this.rowData,
              data:this.$route.query.data1
            }
          })
        }else{
          // 我要危改
          // alert(this.$route.query.nowIndex)
          this.$router.push({
            path: '/RebuildPanel',
            query: {
              data1: this.rowData,
              data2:this.$route.query.data1,
              nowIndex:this.$route.query.nowIndex,
              rowGuid:this.$route.query.rowGuid,
            }
          })
        }

      }
    },
    mounted() {
      this.rowData = JSON.parse(this.$route.query.data)
      // this.getData(JSON.parse(this.$route.query.data).ID)
    }
  };
</script>

<style scoped lang="scss">
  #authenticateUnitDetail{
      height: 100vh;
      overflow: auto;
      padding: 10px;
      .line {
        width: 6px;
        height: 26px;
        background: #007aff;
        display: inline-block;
      }
      .list ul li {
        min-height: 40px;
        line-height: 40px;
      }
  }
</style>
